package com.edu.exam.enums.examination;

/**
 * 冲突类型枚举
 *
 * @author System
 * @version 1.0.0
 * @since 2025-11-12
 */
public enum ConflictType {
    TIME("time", "时间冲突"),
    VENUE("venue", "场地冲突"),
    INVIGILATOR("invigilator", "监考人员冲突"),
    STUDENT("student", "学生冲突"),
    EQUIPMENT("equipment", "设备冲突"),
    RESOURCE("resource", "资源冲突"),
    CAPACITY("capacity", "容量冲突"),
    POLICY("policy", "政策冲突");

    private final String code;
    private final String description;

    ConflictType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ConflictType fromCode(String code) {
        for (ConflictType type : ConflictType.values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown conflict type code: " + code);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}
